<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
       /*登录页面*/
    *{
    	margin:0;
    	padding:0;
    }

    nav{
    	width:100%;
    	height:50px;
    	background: #333;
    	line-height: 50px;
    	padding-left: 100px;
    	color:white;
    	font-size: 25px;
    }
    #box{
    	width:400px;
    	height:250px;
    	margin:100px auto;
        background: #333;
        color:white;
    }
    span{
    	font-size: 30px;
        line-height: 30px;
    }
    #nei{
        margin-top: 20px;
        margin-left: 50px;
    }
    #nei span{
        font-size: 20px;
        line-height: 50px;
    }
    button{
        width:50px;
        height:30px;
        font-size: 16px;
        color:white;
        border:0;
        background: skyblue;
       
    }
    #btn1{
       float: left;
       margin:20px 110px;
    }
    #btn2{
       float: left;
       margin-top:20px;
    }
	</style>
</head>
<body>
	<!-- 登录页面 -->
<nav>China -Pub 后台管理系统</nav>
<div id="box">
<span>Login</span>
<form action="" id="nei">
   <span>管理员:</span><input type="text" name="" id="txt"><br>
   <span>密&nbsp;码:</span><input type="password" name="" id="pwd">
</form>
<button id="btn1">注册</button>
<button id="btn2">登录</button>
</div>

</body>
<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
   $("#btn1").on("click",function(){
      var a1={
        username:$("#txt").val(),
        password:$("#pwd").val()
      }
      $.ajax({
        url:"http://localhost:6500/users",
        type:"post",
        data:a1,
        success:function(data){
            console.log(data);
            alert("注册成功")
        }
      })
   })
   $("#btn2").on("click",function(){
      var a2={
        username:$("#txt").val(),
        password:$("#pwd").val()
      }
      $.ajax({
        url:"http://localhost:6500/users/login",
        type:"post",
        data:a2,
        success:function(data){
            console.log(data);
            window.open("图书.html")
        }

      })
   })
</script>
</html>